package API.DAY8.thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread x = new Thread(){
            public void run(){
                for (int i = 0; i < 5; i++){
                    System.out.println("rose:let me go!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {

                    }

                }
                System.out.println("跳了，噶了");
            }
        };
        Thread y = new Thread(){
            public void run(){
                while (true){
                    try {
                        Thread.sleep(1000);
                        System.out.println("rose:you jump,I jump!");
                    } catch (InterruptedException e) {
                    }
                }
            }
        };
    x.start();
    y.setDaemon(true);
    y.start();
    while (true);
    }
}
